<?php	

	include('db_connection.php');


	class invoiceUser{
	 function get_details($id) {
			//$select = "SELECT * FROM tbl_aff_transfer WHERE at_affilate_id='" . $id . "'";
		        $select = "SELECT course.`course_name`,`course`.`course_fee`,`ebook`.`ebook_name`,ebook.`ebook_fee`,user.*,user.id AS user_id FROM tbl_user_details AS USER 
LEFT JOIN tbl_courses AS course ON user.course_id = course.id 
LEFT JOIN  tbl_ebook AS ebook ON user.course_id = ebook.id 
WHERE user.id =  '" . $id . "' GROUP BY user.user_id ";
			$query = mysql_query($select) or die(mysql_error());

			if (mysql_num_rows($query)) {
				$results = array();
				while ($row = mysql_fetch_array($query)) {
					foreach ($row as $k => $v) {
						$result->$k = $v;
					}

					$results[] = $result;
				}
				return $results;
			}
		}
	}

?>